package com.yyge;
/**
 * bean作用范围
 */

import com.yyge.dao.BookDao;
import com.yyge.service.BookService;
import com.yyge.service.impl.BookServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * ioc控制反转
 */

public class App {
    public static void main(String[] args) {
      String configPath="classpath:ApplicationContext.xml";

        // 基于XML配置IOC容器,由spring负责实现
        ApplicationContext context = new ClassPathXmlApplicationContext(configPath);

        BookService bookService1 = context.getBean(BookService.class);
        BookService bookService2 = context.getBean(BookService.class);
        BookService bookService3 = context.getBean(BookService.class);

        System.out.println(bookService1);
        System.out.println(bookService2);
        System.out.println(bookService3);
    }
}
